package com.tom.demo.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.tom.demo.common.entity.SysDept;
import com.tom.demo.vo.Deprecates;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;
import java.util.Set;

/**
* @author Admin
* @description 针对表【sys_dept】的数据库操作Mapper
* @createDate 2025-02-16 18:35:40
* @Entity generator.domain.SysDept
*/
@Mapper
@DS("master")
public interface SysDeptMapper {

    int deleteByPrimaryKey(String id);

    int insert(SysDept record);


    SysDept selectByPrimaryKey(String id);


    int updateByPrimaryKey(SysDept record);

    List<SysDept> findByAll();

    /**
     * 向下递归查询子部门 返回所有子部门的id
     * @return
     */
    Set<String> findByDeptIdDownward(@Param("deptId") String deptId);

    /**
     * 向上递归查询父部门 返回父部门
     * @param deptId
     * @return
     */
    List<SysDept> findByUserIdUp(@Param("deptId") String deptId);

    SysDept findByDeptCode(@Param("deptCode")String deptCode);

    @MapKey(value = "deptName")
    List<Deprecates> findByDeptEchartsData();

}
